package com.sqx.modules.resumes.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.resumes.entity.Resumes;
import com.sqx.modules.resumes.service.IResumesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wuchang
 * @since 2023-07-24
 */
@RestController
@RequestMapping("/admin/resumes/")
@Api(value = "管理端-我的简历", tags = {"管理端-我的简历"})
public class AdminResumesController {
    @Autowired
    private IResumesService iResumesService;


    @ApiOperation("新增简历")
    @PostMapping(value = "saveResumes")
    public Result saveResumes(Long userId, Resumes resumes) {
        resumes.setUserId(userId);
        return iResumesService.saveResumes(resumes);
    }

    @ApiOperation("获取我的简历列表")
    @GetMapping(value = "getMyResumesList")
    public Result getMyResumesList(Long userId, Integer page, Integer limit, Resumes resumes) {
        resumes.setUserId(userId);
        return Result.success().put("data", iResumesService.getMyResumesList(page, limit, resumes));
    }

    @ApiOperation("删除简历")
    @PostMapping(value = "deleteResumes")
    public Result deleteResumes(Long userId, Long resumesId) {
        return iResumesService.deleteResumes(userId, resumesId);
    }
}
